package com.tianji.learning.controller;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@Api(tags = "互动问题相关接口-管理员")
@RestController
@RequestMapping("/admin/questions")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService questionService;

    @ApiOperation("分页查询问题列表-管理员")
    @GetMapping("page")
    public PageDTO<QuestionAdminVO> queryQuestionAdminVOPage(QuestionAdminPageQuery query){
        return questionService.queryQuestionAdminVOPage(query);
    }

    @ApiOperation("隐藏或显示某个问题-管理员")
    @PutMapping("{id}/hidden/{hidden}")
    public void updateQuestionHiddenState(@PathVariable Long id, @PathVariable Boolean hidden){
        questionService.updateQuestionHiddenState(id, hidden);
    }

    @ApiOperation("查看问题详情-管理员")
    @GetMapping("{id}")
    public QuestionAdminVO queryQuestionAdminVoDetails(@PathVariable Long id){
        return questionService.queryQuestionAdminVoDetails(id);
    }

}
